package org.yefei.homeworkday12;

public class Calculator {
	// 5:计算器有颜色，品牌，价格等属性，有计算加减乘除以及算一个数立方的方法，用oo的思想模拟。
	public String color;
	public String brand;
	public int price;

	public void show() {
		System.out.println("计算器的品牌：" + brand + ",价格：" + price + ",颜色：" + color);
	}

	public double plus(double a, double b) {
		return a + b;
	}

	public double minus(double a, double b) {
		return a - b;
	}

	public double mul(double a, double b) {
		return a * b;
	}

	public double divide(double a, double b) {
		return a / b;
	}

	public double cube(double a) {
		return a * a * a;
	}

	public static void main(String[] args) {
		Calculator cal = new Calculator();
		cal.brand = "小天才";
		cal.color = "black";
		cal.price = 20;
		cal.show();
		double a = 24, b = 8;
		double plus = cal.plus(a, b);
		double minus = cal.minus(a, b);
		double mul = cal.mul(a, b);
		double divide = cal.divide(a, b);
		double cube = cal.cube(a);
		System.out.println(a + "和" + b + "两数之和为：" + plus + ",两数之差为：" + minus + ",两数之积为：" + mul + "两数之商是：" + divide
				+ ",a的立方是：" + cube);
	}
}
